package com.xjscrm.console.web.menu;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.xjscrm.common.entity.SysMenu;
import com.xjscrm.console.param.menu.SysMenuInfoDto;
import com.xjscrm.console.service.common.menu.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "菜单管理", tags = "菜单管理")
@RestController
@RequestMapping(value = "/sysMenu")
public class MenuController {

    @Autowired
    private MenuService menuService;


    @ApiOperation(value = "上传系统菜单", notes = "上传系统菜单",response = Boolean.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/uploadSysMenu")
    public Object uploadSysMenu(@RequestBody SysMenuInfoDto sysMenuInfoDto){
        menuService.uploadSysMenu(sysMenuInfoDto);
        return true;
    }

    @ApiOperation(value = "获取系统菜单", notes = "获取系统菜单",response = SysMenu.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/selectSysMenu")
    public Object selectSysMenu(@RequestBody SysMenuInfoDto sysMenuInfoDto){
        return  menuService.selectByAppKey(sysMenuInfoDto);

    }
}
